package com.blensmile;

import android.app.Application;
import android.database.sqlite.SQLiteDatabase;

import com.blensmile.database.DaoMaster;
import com.blensmile.database.DaoSession;
import com.blensmile.database.TestOpenHelper;
import com.blensmile.utils.Constants;
import com.squareup.leakcanary.LeakCanary;

/**
 * Created by Blensmile on 2016/11/14.
 */
public class App extends Application{
    public static Application app;
    public static boolean isNetWorkOk = false;//全局的网络状态，TODO 设置网络状态变化监听
    private TestOpenHelper mHelper;
    private SQLiteDatabase db;
    private DaoMaster mDaoMaster;
    private DaoSession mDaoSession;

    @Override
    public void onCreate() {
        super.onCreate();
        app = this;
        LeakCanary.install(this);
        setDatabase();
    }

     private void setDatabase() {
        mHelper = new TestOpenHelper(this, Constants.DEBUG?"debug":"jade",null);
        db = mHelper.getWritableDatabase();
        mDaoMaster = new DaoMaster(db);
        mDaoSession = mDaoMaster.newSession();
    }



}
